﻿using System;
using System.Windows.Forms;
using VkApiVer2.Properties;

namespace VkApiVer2.Forms
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        private void Button1Click(object sender, EventArgs e)
        {

        }

        /*
                private void CreateNewSettings(string username, string password, string settingsFile)
                {
                    var user = new User { Username = username, Password = password };
                    var usersList = new List<User> { user };
                    SettingsManager.SerializeToXML(usersList, settingsFile);
                    SuccessLogin(user);
                }
        */

        private void SuccessLogin(User user)
        {
            Settings.Default[SettingsConstants.UserName] = user.Username;
            Settings.Default[SettingsConstants.Expire] = user.Expire;
            Settings.Default[SettingsConstants.Token] = user.AccessToken;
            Settings.Default[SettingsConstants.UserId] = user.Id;
            Close();
        }
    }
}
